Add infallible primitive type lookups to template arg resolver#157289
Conversation
|
|
There was a problem hiding this comment.
Thanks, this indeed improves the output for me locally (msvc, lldb 22).
Test case
Used a tiny test case
//@ compile-flags: -g
//@ lldb-command: run
//@ lldb-command: v vec_0
//@ lldb-check: [...] vec_0 { }
//@ lldb-command: continue
fn main() {
let vec_0 = vec![1, 2, 3];
vec_0; // #break
}
I do indeed observe the fixed ouput 👍
v vec_0
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_0 = size=3 { [0] = 1 [1] = 2 [2] = 3 }
Other remarks
Looks like the package change meant that lldb_batchmode/runner.py need to update the path in which breakpoint_callback is referenced (as discussed),
diff --git a/src/etc/lldb_batchmode/runner.py b/src/etc/lldb_batchmode/runner.py
index e9b106390f6..bdeee3f3458 100644
--- a/src/etc/lldb_batchmode/runner.py
+++ b/src/etc/lldb_batchmode/runner.py
@@ -98,7 +98,7 @@ def execute_command(command_interpreter, command):
"registering breakpoint callback, id = " + str(breakpoint_id)
)
callback_command = f"breakpoint command add -s python {str(breakpoint_id)} -o \
- 'import lldb_batchmode; lldb_batchmode.breakpoint_callback'"
+ 'import lldb_batchmode; lldb_batchmode.runner.breakpoint_callback'"
command_interpreter.HandleCommand(callback_command, res)
if res.Succeeded():We can just roll this into this PR, you can r=me after.
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
There was a problem hiding this comment.
This comment has been minimized.
This comment has been minimized.
|
This pull request was unapproved due to being closed. |
|
@bors r+ |
…eyouxu
Add infallible primitive type lookups to template arg resolver
Fixes a regression that seem to come from LLDB 22 where looking up primitive types by name on MSVC no longer works. Container types use type name lookups to resolve generics, so it causes container types (e.g. `Vec<i32>`) to fail to create their child values.
Before:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {}
(lldb) v vec_v[0]
error: <user expression 0>:1:6: array index 0 is not valid for "(Vec<i32,alloc::alloc::Global>) vec_v"
1 | vec_v[0]
| ^
```
After:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {
[0] = 10
[1] = 20
[2] = 30
[3] = 40
[4] = 50
}
(lldb) v vec_v[0]
(long) vec_v[0] = 10
```
This patch maps the type name to its `eBasicType` equivalent (i.e. the LLDB enum for primitive types) and looks up the type based on that. AFAIK, `eBasicType` lookups are 100% infallible. Even if the primitive type somehow isn't in the debug info, `TypeSystemClang` will invent the appropriate `SBType` object for it.
This isn't a major blocker for the test suite rework, but it does prevent me from blessing tests with container types on MSVC unless I downgrade to LLDB 21.
r? @jieyouxu, @Kobzol
bde0008 to
c6945a5
Compare
|
should be good now, just gated the import behind a feature flag. |
|
@bors try jobs=aarch64-apple |
This comment has been minimized.
This comment has been minimized.
Add infallible primitive type lookups to template arg resolver try-job: aarch64-apple
|
@bors r+ |
|
@bors rollup=iffy |
…eyouxu
Add infallible primitive type lookups to template arg resolver
Fixes a regression that seem to come from LLDB 22 where looking up primitive types by name on MSVC no longer works. Container types use type name lookups to resolve generics, so it causes container types (e.g. `Vec<i32>`) to fail to create their child values.
Before:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {}
(lldb) v vec_v[0]
error: <user expression 0>:1:6: array index 0 is not valid for "(Vec<i32,alloc::alloc::Global>) vec_v"
1 | vec_v[0]
| ^
```
After:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {
[0] = 10
[1] = 20
[2] = 30
[3] = 40
[4] = 50
}
(lldb) v vec_v[0]
(long) vec_v[0] = 10
```
This patch maps the type name to its `eBasicType` equivalent (i.e. the LLDB enum for primitive types) and looks up the type based on that. AFAIK, `eBasicType` lookups are 100% infallible. Even if the primitive type somehow isn't in the debug info, `TypeSystemClang` will invent the appropriate `SBType` object for it.
This isn't a major blocker for the test suite rework, but it does prevent me from blessing tests with container types on MSVC unless I downgrade to LLDB 21.
r? @jieyouxu, @Kobzol
…eyouxu
Add infallible primitive type lookups to template arg resolver
Fixes a regression that seem to come from LLDB 22 where looking up primitive types by name on MSVC no longer works. Container types use type name lookups to resolve generics, so it causes container types (e.g. `Vec<i32>`) to fail to create their child values.
Before:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {}
(lldb) v vec_v[0]
error: <user expression 0>:1:6: array index 0 is not valid for "(Vec<i32,alloc::alloc::Global>) vec_v"
1 | vec_v[0]
| ^
```
After:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {
[0] = 10
[1] = 20
[2] = 30
[3] = 40
[4] = 50
}
(lldb) v vec_v[0]
(long) vec_v[0] = 10
```
This patch maps the type name to its `eBasicType` equivalent (i.e. the LLDB enum for primitive types) and looks up the type based on that. AFAIK, `eBasicType` lookups are 100% infallible. Even if the primitive type somehow isn't in the debug info, `TypeSystemClang` will invent the appropriate `SBType` object for it.
This isn't a major blocker for the test suite rework, but it does prevent me from blessing tests with container types on MSVC unless I downgrade to LLDB 21.
r? @jieyouxu, @Kobzol
…eyouxu
Add infallible primitive type lookups to template arg resolver
Fixes a regression that seem to come from LLDB 22 where looking up primitive types by name on MSVC no longer works. Container types use type name lookups to resolve generics, so it causes container types (e.g. `Vec<i32>`) to fail to create their child values.
Before:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {}
(lldb) v vec_v[0]
error: <user expression 0>:1:6: array index 0 is not valid for "(Vec<i32,alloc::alloc::Global>) vec_v"
1 | vec_v[0]
| ^
```
After:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {
[0] = 10
[1] = 20
[2] = 30
[3] = 40
[4] = 50
}
(lldb) v vec_v[0]
(long) vec_v[0] = 10
```
This patch maps the type name to its `eBasicType` equivalent (i.e. the LLDB enum for primitive types) and looks up the type based on that. AFAIK, `eBasicType` lookups are 100% infallible. Even if the primitive type somehow isn't in the debug info, `TypeSystemClang` will invent the appropriate `SBType` object for it.
This isn't a major blocker for the test suite rework, but it does prevent me from blessing tests with container types on MSVC unless I downgrade to LLDB 21.
r? @jieyouxu, @Kobzol
…uwer Rollup of 10 pull requests Successful merges: - #157447 (Move cross crate tests into the appropriate folder) - #145108 (Resolver: Batched Import Resolution) - #156119 (Further optimize `SliceIndex<str>` impl for `Range<usize>`) - #157289 (Add infallible primitive type lookups to template arg resolver) - #157540 (Cleanup and optimize `render_impls`) - #157543 (Reorganize `tests/ui/issues` [5/N]) - #156188 (riscv: promote d, e, and f target_features to CfgStableToggleUnstable) - #157323 (Document Repeat::last panic behavior) - #157545 (Suggest using comma to separate valid attribute list items) - #157559 (chore: Update annotate-snippets to 0.12.16)
…uwer Rollup of 10 pull requests Successful merges: - #157447 (Move cross crate tests into the appropriate folder) - #145108 (Resolver: Batched Import Resolution) - #156119 (Further optimize `SliceIndex<str>` impl for `Range<usize>`) - #157289 (Add infallible primitive type lookups to template arg resolver) - #157540 (Cleanup and optimize `render_impls`) - #157543 (Reorganize `tests/ui/issues` [5/N]) - #156188 (riscv: promote d, e, and f target_features to CfgStableToggleUnstable) - #157323 (Document Repeat::last panic behavior) - #157545 (Suggest using comma to separate valid attribute list items) - #157559 (chore: Update annotate-snippets to 0.12.16)
…eyouxu
Add infallible primitive type lookups to template arg resolver
Fixes a regression that seem to come from LLDB 22 where looking up primitive types by name on MSVC no longer works. Container types use type name lookups to resolve generics, so it causes container types (e.g. `Vec<i32>`) to fail to create their child values.
Before:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {}
(lldb) v vec_v[0]
error: <user expression 0>:1:6: array index 0 is not valid for "(Vec<i32,alloc::alloc::Global>) vec_v"
1 | vec_v[0]
| ^
```
After:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {
[0] = 10
[1] = 20
[2] = 30
[3] = 40
[4] = 50
}
(lldb) v vec_v[0]
(long) vec_v[0] = 10
```
This patch maps the type name to its `eBasicType` equivalent (i.e. the LLDB enum for primitive types) and looks up the type based on that. AFAIK, `eBasicType` lookups are 100% infallible. Even if the primitive type somehow isn't in the debug info, `TypeSystemClang` will invent the appropriate `SBType` object for it.
This isn't a major blocker for the test suite rework, but it does prevent me from blessing tests with container types on MSVC unless I downgrade to LLDB 21.
r? @jieyouxu, @Kobzol
…eyouxu
Add infallible primitive type lookups to template arg resolver
Fixes a regression that seem to come from LLDB 22 where looking up primitive types by name on MSVC no longer works. Container types use type name lookups to resolve generics, so it causes container types (e.g. `Vec<i32>`) to fail to create their child values.
Before:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {}
(lldb) v vec_v[0]
error: <user expression 0>:1:6: array index 0 is not valid for "(Vec<i32,alloc::alloc::Global>) vec_v"
1 | vec_v[0]
| ^
```
After:
```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {
[0] = 10
[1] = 20
[2] = 30
[3] = 40
[4] = 50
}
(lldb) v vec_v[0]
(long) vec_v[0] = 10
```
This patch maps the type name to its `eBasicType` equivalent (i.e. the LLDB enum for primitive types) and looks up the type based on that. AFAIK, `eBasicType` lookups are 100% infallible. Even if the primitive type somehow isn't in the debug info, `TypeSystemClang` will invent the appropriate `SBType` object for it.
This isn't a major blocker for the test suite rework, but it does prevent me from blessing tests with container types on MSVC unless I downgrade to LLDB 21.
r? @jieyouxu, @Kobzol
Rollup of 25 pull requests Successful merges: - #157447 (Move cross crate tests into the appropriate folder) - #145108 (Resolver: Batched Import Resolution) - #156119 (Further optimize `SliceIndex<str>` impl for `Range<usize>`) - #157224 (Manually unroll loop in `str::floor_char_boundary`) - #157289 (Add infallible primitive type lookups to template arg resolver) - #157540 (Cleanup and optimize `render_impls`) - #157444 (Couple of work product cleanups) - #157543 (Reorganize `tests/ui/issues` [5/N]) - #153513 (Syntactically reject equality predicates) - #155797 (LineWriter: cap write_vectored newline scan to avoid quadratic write_all_vectored) - #156155 (macros: report unbound metavariables directly) - #156188 (riscv: promote d, e, and f target_features to CfgStableToggleUnstable) - #156666 (Clarify meaning of ranges in pointer offset docs) - #157078 (Document equivalence of `highest_one` and `ilog2` methods on integers) - #157129 (ci: update download-artifact action to v8) - #157169 (triagebot: Update messages to direct changes to appropriate repositories) - #157323 (Document Repeat::last panic behavior) - #157370 (Clarify MaybeUninit::zeroed padding docs) - #157399 (Silence llbc's output by default to prevent rustc's linker output warning) - #157500 (Improve documentation of `align_of` and `Alignment`.) - #157545 (Suggest using comma to separate valid attribute list items) - #157559 (chore: Update annotate-snippets to 0.12.16) - #157560 (In `copy_nonoverlapping`, use `mul nuw nsw` to compute the byte size) - #157580 (Importing suggestion reported twice when reporting privacy error) - #157581 (Test fixup)
Rollup of 25 pull requests Successful merges: - #157447 (Move cross crate tests into the appropriate folder) - #145108 (Resolver: Batched Import Resolution) - #156119 (Further optimize `SliceIndex<str>` impl for `Range<usize>`) - #157224 (Manually unroll loop in `str::floor_char_boundary`) - #157289 (Add infallible primitive type lookups to template arg resolver) - #157540 (Cleanup and optimize `render_impls`) - #157444 (Couple of work product cleanups) - #157543 (Reorganize `tests/ui/issues` [5/N]) - #153513 (Syntactically reject equality predicates) - #155797 (LineWriter: cap write_vectored newline scan to avoid quadratic write_all_vectored) - #156155 (macros: report unbound metavariables directly) - #156188 (riscv: promote d, e, and f target_features to CfgStableToggleUnstable) - #156666 (Clarify meaning of ranges in pointer offset docs) - #157078 (Document equivalence of `highest_one` and `ilog2` methods on integers) - #157129 (ci: update download-artifact action to v8) - #157169 (triagebot: Update messages to direct changes to appropriate repositories) - #157323 (Document Repeat::last panic behavior) - #157370 (Clarify MaybeUninit::zeroed padding docs) - #157399 (Silence llbc's output by default to prevent rustc's linker output warning) - #157500 (Improve documentation of `align_of` and `Alignment`.) - #157545 (Suggest using comma to separate valid attribute list items) - #157559 (chore: Update annotate-snippets to 0.12.16) - #157560 (In `copy_nonoverlapping`, use `mul nuw nsw` to compute the byte size) - #157580 (Importing suggestion reported twice when reporting privacy error) - #157581 (Test fixup)
Rollup of 25 pull requests Successful merges: - rust-lang/rust#157447 (Move cross crate tests into the appropriate folder) - rust-lang/rust#145108 (Resolver: Batched Import Resolution) - rust-lang/rust#156119 (Further optimize `SliceIndex<str>` impl for `Range<usize>`) - rust-lang/rust#157224 (Manually unroll loop in `str::floor_char_boundary`) - rust-lang/rust#157289 (Add infallible primitive type lookups to template arg resolver) - rust-lang/rust#157540 (Cleanup and optimize `render_impls`) - rust-lang/rust#157444 (Couple of work product cleanups) - rust-lang/rust#157543 (Reorganize `tests/ui/issues` [5/N]) - rust-lang/rust#153513 (Syntactically reject equality predicates) - rust-lang/rust#155797 (LineWriter: cap write_vectored newline scan to avoid quadratic write_all_vectored) - rust-lang/rust#156155 (macros: report unbound metavariables directly) - rust-lang/rust#156188 (riscv: promote d, e, and f target_features to CfgStableToggleUnstable) - rust-lang/rust#156666 (Clarify meaning of ranges in pointer offset docs) - rust-lang/rust#157078 (Document equivalence of `highest_one` and `ilog2` methods on integers) - rust-lang/rust#157129 (ci: update download-artifact action to v8) - rust-lang/rust#157169 (triagebot: Update messages to direct changes to appropriate repositories) - rust-lang/rust#157323 (Document Repeat::last panic behavior) - rust-lang/rust#157370 (Clarify MaybeUninit::zeroed padding docs) - rust-lang/rust#157399 (Silence llbc's output by default to prevent rustc's linker output warning) - rust-lang/rust#157500 (Improve documentation of `align_of` and `Alignment`.) - rust-lang/rust#157545 (Suggest using comma to separate valid attribute list items) - rust-lang/rust#157559 (chore: Update annotate-snippets to 0.12.16) - rust-lang/rust#157560 (In `copy_nonoverlapping`, use `mul nuw nsw` to compute the byte size) - rust-lang/rust#157580 (Importing suggestion reported twice when reporting privacy error) - rust-lang/rust#157581 (Test fixup)
Rollup of 25 pull requests Successful merges: - rust-lang/rust#157447 (Move cross crate tests into the appropriate folder) - rust-lang/rust#145108 (Resolver: Batched Import Resolution) - rust-lang/rust#156119 (Further optimize `SliceIndex<str>` impl for `Range<usize>`) - rust-lang/rust#157224 (Manually unroll loop in `str::floor_char_boundary`) - rust-lang/rust#157289 (Add infallible primitive type lookups to template arg resolver) - rust-lang/rust#157540 (Cleanup and optimize `render_impls`) - rust-lang/rust#157444 (Couple of work product cleanups) - rust-lang/rust#157543 (Reorganize `tests/ui/issues` [5/N]) - rust-lang/rust#153513 (Syntactically reject equality predicates) - rust-lang/rust#155797 (LineWriter: cap write_vectored newline scan to avoid quadratic write_all_vectored) - rust-lang/rust#156155 (macros: report unbound metavariables directly) - rust-lang/rust#156188 (riscv: promote d, e, and f target_features to CfgStableToggleUnstable) - rust-lang/rust#156666 (Clarify meaning of ranges in pointer offset docs) - rust-lang/rust#157078 (Document equivalence of `highest_one` and `ilog2` methods on integers) - rust-lang/rust#157129 (ci: update download-artifact action to v8) - rust-lang/rust#157169 (triagebot: Update messages to direct changes to appropriate repositories) - rust-lang/rust#157323 (Document Repeat::last panic behavior) - rust-lang/rust#157370 (Clarify MaybeUninit::zeroed padding docs) - rust-lang/rust#157399 (Silence llbc's output by default to prevent rustc's linker output warning) - rust-lang/rust#157500 (Improve documentation of `align_of` and `Alignment`.) - rust-lang/rust#157545 (Suggest using comma to separate valid attribute list items) - rust-lang/rust#157559 (chore: Update annotate-snippets to 0.12.16) - rust-lang/rust#157560 (In `copy_nonoverlapping`, use `mul nuw nsw` to compute the byte size) - rust-lang/rust#157580 (Importing suggestion reported twice when reporting privacy error) - rust-lang/rust#157581 (Test fixup)
View all comments
Fixes a regression that seem to come from LLDB 22 where looking up primitive types by name on MSVC no longer works. Container types use type name lookups to resolve generics, so it causes container types (e.g.
Vec<i32>) to fail to create their child values.Before:
After:
This patch maps the type name to its
eBasicTypeequivalent (i.e. the LLDB enum for primitive types) and looks up the type based on that. AFAIK,eBasicTypelookups are 100% infallible. Even if the primitive type somehow isn't in the debug info,TypeSystemClangwill invent the appropriateSBTypeobject for it.This isn't a major blocker for the test suite rework, but it does prevent me from blessing tests with container types on MSVC unless I downgrade to LLDB 21.
r? @jieyouxu, @Kobzol